<?php

/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Game
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
  
?>

<?php if ($this->paginator->getTotalItemCount()): ?>

    <ul class="games_blocks">
	    <?php foreach( $this->paginator as $game ): ?>      
	      <li>
            <?php if ($this->showphoto): ?>
              <div class="game_photo">
                <?php echo $this->htmlLink($game->getHref(), $this->itemPhoto($game, 'thumb.normal'));?>
              </div>
            <?php endif; ?>
            <div class="game_content">
              <div class="game_title">
                <?php echo $this->partial('index/_title.tpl', 'game', array('game' => $game, 'max_title_length' => 28))?>
              </div>
              <?php if ($this->showdetails): ?>
                <div class="game_details">
                  <?php echo $this->htmlLink($game->getCategory()->getHref(), $this->translate($game->getCategory()->getTitle())); ?>
                </div>
              <?php endif; ?>    
              <?php if ($this->showmeta): ?>
                <div class="game_meta">
                  <?php 
                    $meta_options = array('game' => $game);
                    if ($this->order == 'mostcommented') {
                      $meta_options['show_comments'] = true;
                    }
                    else if ($this->order == 'mostviewed') {
                      $meta_options['show_views'] = true;
                    }
                    else if ($this->order == 'mostliked') {
                      $meta_options['show_likes'] = true;
                    }
                    else if ($this->order == 'mostfavorited') {
                      $meta_options['show_favorites'] = true;
                    }
                    else if ($this->order == 'lastupdated') {
                      $meta_options['show_updated'] = true;
                    }
                    else {
                      $meta_options['show_created'] = true;
                    }
                  ?>
                  <?php echo $this->partial('index/_meta.tpl', 'game', $meta_options)?>
                </div>
              <?php endif; ?>
            </div>
              <?php if ($game->leaderboard_enabled): ?>
                <div class="game_icons">
                  <span class="game_icon_leaderboard<?php if (!$game->leaderboard_enabled) echo "_off"?>"></span>
                </div>
              <?php endif;?>
	      </li>
	    <?php endforeach; ?>
    </ul>

<?php else: ?>
  <div class="tip">
    <span>
      <?php echo $this->translate('There are no games posted yet.');?>
    </span>
  </div>  
<?php endif; ?>

<div class="game_profile_games_link">
  <?php if ($this->paginator->getTotalItemCount()): ?>
    <?php echo $this->htmlLink(array('route'=>'game_general', 'action'=>'browse', 'user'=>$this->subject()->getIdentity()), 
          $this->translate('View All Games'),
          array('class' => 'buttonlink icon_game_view')
        )?>
  <?php endif; ?>
</div>     